//
//  ViewController.m
//  Timer2
//
//  Created by HenryYang on 13-8-26.
//  Copyright (c) 2013年 杨 利民. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property(weak,nonatomic) NSTimer *timer;
@property(nonatomic) int count;
@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(timerFired:) userInfo:nil repeats:YES];
    [self.timer invalidate];
  self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(timerFired:) userInfo:nil repeats:YES];
    self.count=0;
   
}
-(void) timerFired:(NSTimer *)paramTimer
{
    self.count++;
    self.myLabel.text=[NSString stringWithFormat:@"%i",self.count];
    if(self.count==3)
       [self.timer invalidate];
        
        }
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
